const http=require("http")
var fs=require("fs")
const server=http.createServer((req,res)=>{
    if(req.url=="/txt"){
       res.writeHead(200,{"Content-Type":"text/PLAIN"})
        res.end("dasdasd")
    }else if(req.url=="/json"){
        res.writeHead(200,{"Content-Type":"application/json"})
           res.end(JSON.stringify({code:1,list:[1,2,3]}))
    }else if(req.url=="/jpg"){
        res.writeHead(200,{"Content-Type":"image/jpeg"})
         let imgBuff=fs.readFileSync("./1.jpg")
         res.end(imgBuff);
    }
})
server.listen(3000,()=>{
    console.log(process.pid)
    console.log("running")
})